package pers.xuehongyan.useat.server.enity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;

import java.sql.Timestamp;

/**
 * @author xuehongyan
 */
@Data
@TableName("seat")
public class Seat {
    @TableId(value = "id", type = IdType.AUTO)
    Integer id;

    @TableField(value = "user_id", insertStrategy = FieldStrategy.IGNORED, updateStrategy = FieldStrategy.IGNORED)
    Integer userId;

    @TableField(value = "machine_id", insertStrategy = FieldStrategy.IGNORED, updateStrategy = FieldStrategy.IGNORED)
    Integer machineId;

    @TableField(value = "rented", insertStrategy = FieldStrategy.IGNORED, updateStrategy = FieldStrategy.IGNORED)
    Timestamp rented;

    @TableField(value = "secret")
    String secret;

    public Seat() {
        this.userId = null;
        this.machineId = null;
        this.rented = null;
        this.secret = null;
    }

    public boolean isRenting() {
        return userId != null;
    }
}
